package cn.hdu.liang.ch02;

import net.jcip.annotations.NotThreadSafe;

/**
 * 延迟初始化中的竞态条件
 */

@NotThreadSafe
public class LazyInitRace {
    private ExpensiveObject instance = null;

    public ExpensiveObject getInstance() {
        if(instance == null)
            instance = new ExpensiveObject();
        return instance;
    }
}

class ExpensiveObject {
}

